package com.integrationpath.mengine.webapp.decorator;

import org.displaytag.decorator.TableDecorator;
import com.integrationpath.mengine.model.AppUser;
import com.integrationpath.mengine.webapp.listener.StartupListener;

public class UserDecorator extends TableDecorator {
	
	String response = "";
	AppUser message;
	
	public UserDecorator() {		
	}
	
	public String getAdminState() {
		AppUser user = (AppUser)getCurrentRowObject();
		if (user.isAccountLocked() == false)
			response = "<a id='image" + user.getId() + "' onclick='changeAppUserStatusCode(" + user.getId() + "," + user.isAccountLocked() + ")'><img alt='ENABLED' src='" + StartupListener.getAppContext().getAttribute("path_theme") + "/images/available.png'/><a/>";
			else
			response = "<a id='image" + user.getId() + "' onclick='changeAppUserStatusCode(" + user.getId() + "," + user.isAccountLocked() +  ")'><img alt='DISABLED' src='" + StartupListener.getAppContext().getAttribute("path_theme") + "/images/unavailable.png'/><a/>";

		return response;
	}

}
